@(userForm: Form[User])

@import helper._
@import html5.tags.html._

@implicitFieldConstructor = @{ FieldConstructor(twitterBootstrapInput.render) } 

@main("admin")("users"){
        	<div class="span10">
				<div class="btn-toolbar">
	        	    <div class="btn-group">
					    <a class="btn btn-info" href="@routes.Admin.users()" rel="tooltip" title="@Messages("admin.users.links.list")"><i class="icon-list-alt"></i></a>
				    </div>
	        	    <div class="btn-group">
					    <a class="btn" href="@routes.Admin.newuser()" rel="tooltip" title="@Messages("admin.users.links.new")"><i class="icon-file"></i></a>
				    </div>
				</div>
			    
			    @form(routes.Admin.saveuser(), 'class -> "form-horizontal") {
			        <legend>@Messages("admin.users.add.header")</legend>
			        
		            @text(userForm("login"), '_label -> Messages("common.login"), '_showConstraints -> false, 'class -> "input-small")
		            @text(userForm("name"), '_label -> Messages("common.name"), '_showConstraints -> false)
		            @if((session.get("level") == "ADMIN")) {
          			@select(
		                userForm("role"), 
		                options = Seq("READ"->Messages("common.read"),"WRITE"->Messages("common.write"),"ADMIN"->Messages("common.admin")), 
		                '_label -> Messages("common.role"),
		                '_showConstraints -> false, 
		                'class -> "input-medium"
		            )
		            } 
					@if((session.get("level") == "WRITE")) {
		            @select(
		                userForm("role"), 
		                options = Seq("READ"->Messages("common.read"),"WRITE"->Messages("common.write")), 
		                '_label -> Messages("common.role"),
		                '_showConstraints -> false, 
		                'class -> "input-medium"
		            )
		            }
			        @password(userForm("password"), '_label -> Messages("common.password"), '_showConstraints -> false)
		            
					<div class="control-group">
						<div class="controls">
				            <input type="submit" value="@Messages("admin.users.add.confirm")" class="btn btn-success"> @Messages("common.or")
				            <a href="@routes.Admin.users()">@Messages("common.cancel")</a> 
				        </div>
				    </div>
			        
			    }
			</div>
    
}